A parallel or serial vector of values. More...
#include <vector.hpp>
Public Types | |
typedef BaseVectorInterface< T, I >::IdxType | IdxType |
typedef BaseVectorInterface< T, I >::TheType | TheType |
Public Member Functions | |
VectorT (const parallel::Communicator &comm, const int &local_length) | |
Default constructor. | |
VectorT (ImplType *vimpl) | |
Constuct with an existing implementation. | |
~VectorT (void) | |
Destructor. | |
VectorT * | clone (void) const |
VectorT * | localClone (void) const |
Make a (sequential) copy of a vector local to this processor. | |
void | add (const VectorT &x, const TheType &scale=1.0) |
Add the specified vector. | |
void | add (const TheType &x) |
Add the specified value to all elements. | |
void | equate (const VectorT &x) |
Copy the elements from the specified Vector. | |
void | elementMultiply (const VectorT &x) |
Element-by-element multiply by another Vector. | |
void | elementDivide (const VectorT &x) |
ELement-by-element divide by another Vector. |
A parallel or serial vector of values.
This class encapsulates a vector of values.
When a VectorT is instantiated it is ready to be filled using calls to methods like setElement(). When the VectorT is filled, all processors must be notified that it is ready to use with a call to ready().
For efficiency, setElement(), and related calls, should only set locally owned elements, even though off processor elements can be set with those methods. getElement(), and related calls, can only access locally owned elements. Off processor values can be obtained by calling get_all_elements() (currently the only way).
Element indexing is always global and 0-based.
This class uses the Pimpl idiom for implementation so the interface is completely free of the underlying library. This class simply provides an interface to a specific implementation.
typedef BaseVectorInterface<T, I>::IdxType gridpack::math::VectorT< T, I >::IdxType |
The size/index type used
Reimplemented from gridpack::math::BaseVectorInterface< T, I >.
typedef BaseVectorInterface<T, I>::TheType gridpack::math::VectorT< T, I >::TheType |
The numeric type used
Reimplemented from gridpack::math::BaseVectorInterface< T, I >.
gridpack::math::VectorT< T, I >::VectorT | ( | const parallel::Communicator & | comm, | |
const int & | local_length | |||
) |
Default constructor.
Collective.
A vector must be instantiated simulutaneously on all processes involved in the specified communicator. Each process in the communicator will own the number of elements requested.
comm | parallel environment | |
local_length | number of elements to be assigned to this process |
gridpack::math::VectorT< T, I >::VectorT | ( | ImplType * | vimpl | ) | [explicit] |
Constuct with an existing implementation.
This constructor is used to create a new vector instance using an existing VectorImplementation instance. This is needed by certain vector operations.
vimpl | pointer to a new, allocated VectorImplementation instance |
References gridpack::parallel::WrappedDistributed::WrappedDistributed().
gridpack::math::VectorT< T, I >::~VectorT | ( | void | ) |
Destructor.
Collective.
A vector must be destroyed simulutaneously on all processes involved in the communicator used to instantiate it.
void gridpack::math::VectorT< T, I >::add | ( | const TheType & | x | ) |
Add the specified value to all elements.
Collective.
x |
void gridpack::math::VectorT< T, I >::add | ( | const VectorT< T, I > & | x, | |
const TheType & | scale = 1.0 | |||
) |
Add the specified vector.
Collective.
x | ||
scale |
VectorT* gridpack::math::VectorT< T, I >::clone | ( | void | ) | const |
Make an exact replica of this instance Collective.
References gridpack::math::VectorT< T, I >::VectorT().
void gridpack::math::VectorT< T, I >::elementDivide | ( | const VectorT< T, I > & | x | ) |
ELement-by-element divide by another Vector.
void gridpack::math::VectorT< T, I >::elementMultiply | ( | const VectorT< T, I > & | x | ) |
Element-by-element multiply by another Vector.
void gridpack::math::VectorT< T, I >::equate | ( | const VectorT< T, I > & | x | ) |
Copy the elements from the specified Vector.
Collective.
x |
VectorT* gridpack::math::VectorT< T, I >::localClone | ( | void | ) | const |
Make a (sequential) copy of a vector local to this processor.
References gridpack::parallel::WrappedDistributed::communicator(), gridpack::math::BaseVectorInterface< T, I >::getAllElements(), gridpack::math::BaseVectorInterface< T, I >::localIndexRange(), gridpack::math::BaseVectorInterface< T, I >::ready(), gridpack::math::BaseVectorInterface< T, I >::setElementRange(), gridpack::math::BaseVectorInterface< T, I >::size(), and gridpack::math::VectorT< T, I >::VectorT().